package mblog.quartz;

import mblog.PostUtils;
import mblog.base.jsoup.BaiXingUtils;
import mblog.base.utils.AnsjUtils;
import mblog.core.data.AccountProfile;
import mblog.core.data.Post;
import mblog.core.persist.service.PostService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;
import java.util.Map;

@Configuration
@Component
@EnableScheduling // 该注解必须要加
public class ScheduleTask {

    @Value("${baixing.jsoup.url}")
    private String jsoupUrl;

    @Autowired
    private PostService postService;


    public void scheduleTest() {
        System.out.println("jsoupUrl"+jsoupUrl);

        PostUtils.insertPosts(postService,jsoupUrl);

        System.err.println("scheduleTest开始定时执行");


        //        //根据title进行分词 简写标签像 取名词 词性的
//        String[] strings = new String[]{"n"};//目前只取名词
//        String tags = AnsjUtils.analysis(strings,postTitles);
//        p.setTags(tags);
//        p.setEditor("ueditor");

    }
}
